﻿using System;
using System.Collections.Generic;
using System.Linq;

namespace Sustainalytics.ClientDW.Entities
{
    public class GCPrincipleConclusion : IEqualityComparer<GCPrincipleConclusion>
    {
        public Guid Id { get; set; }
        public List<string> AssessmentComments { get; set; }
        public string AssessmentSummaryAndConclusionIntroductionSentence { get; set; }

        public bool Equals(GCPrincipleConclusion x, GCPrincipleConclusion y)
        {
            if (x == null && y == null)
                return true;

            if (x == null || y == null)
                return false;

            return
                x.Id == y.Id
                && ((x.AssessmentComments == null && y.AssessmentComments == null)
                    || (x.AssessmentComments != null && y.AssessmentComments != null && x.AssessmentComments.SequenceEqual(y.AssessmentComments)))
                && x.AssessmentSummaryAndConclusionIntroductionSentence == y.AssessmentSummaryAndConclusionIntroductionSentence;
        }

        public int GetHashCode(GCPrincipleConclusion obj)
        {
            return this.Id.GetHashCode();
        }
    }
}
